﻿using EFModel;
using IServices;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Y2.Filters;

namespace Y2.Controllers
{
    [LoginFilter]
    public class major_changeToController : Controller
    {
        private readonly Imajor_change he;

        public major_changeToController(Imajor_change he)
        {
            this.he = he;
        }

        public IActionResult major_changeTo()
        {
            return View();
        }
        public IActionResult major_changeToUpdate(int? id)
        {
            ViewBag.mch_id = id;
            return View();
        }
        //调动查询
        public async Task<IActionResult> QuerTo(int currentPage, int pageSize)
        {
            return Content(JsonConvert.SerializeObject(await he.QuerTo(currentPage, pageSize)));
        }
        //调动为通过查询
        public async Task<IActionResult> QuersTo(int id)
        {
            return Content(JsonConvert.SerializeObject(await he.QuersTo(id)));
        }
        //调动不通过修改
        public async Task<int> Update(major_change major_)
        {
            return await he.Update(major_);
        }
        //调动通过人力资源修改
        public async Task<int> UpdateTo(human_file _File)
        {
            return await he.UpdateTo(_File);
        }
        //调动不通过人力资源修改
        public async Task<string> UpdateDdTo(string id)
        {
            return await he.UpdateDdTo(id);
        }
    }
}
